﻿Imports Phila
Imports Phila.Sql
Imports Phila.CommonClasses

Public Class ZoneTours
    Inherits System.Web.UI.Page

    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        Try
            If Not Request.QueryString("zid") Is Nothing Then
                'Fill_dtList(dlTours, "select t.*, ct.*, z.Name as ZoneName, (select tc.Pax_1 from ptn_TourCost where TourId=t.Id and tc.StartDate <= getdate() and tc.EndDate >= getdate()) as Amount from ptn_Tours t inner join ptn_CatZoneTours ct on ct.TourId=t.Id inner join ptn_Zones z on z.Id=ct.ZoneId where t.IsActive=1 and ct.ZoneId=" & Request.QueryString("zid"))
                'Fill_dtList(dlTours, "select t.*, ct.*, z.Name as ZoneName, (select tc.Pax_1 from ptn_TourCost where TourId=t.Id and tc.StartDate <= getdate() and tc.EndDate >= getdate()) as Amount from ptn_Tours t inner join ptn_TourCost tc on tc.TourId=t.Id inner join ptn_CatZoneTours ct on ct.TourId=t.Id inner join ptn_Zones z on z.Id=ct.ZoneId where t.IsActive=1 and ct.ZoneId=" & Request.QueryString("zid"))
                'Fill_dtList(dlTours, "select t.*, z.Name as ZoneName from ptn_Tours t inner join ptn_CatZoneTours zt on zt.tourid=t.id inner join ptn_Zones z on z.id=zt.zoneid where t.IsActive=1 and zt.Zoneid=" & Request.QueryString("zid"))
                Dim strSql As String
                strSql = "select t.*,z.Name as ZoneName, ISNULL(tc.pax_1,0) as Price from ptn_Tours t inner join ptn_CatZoneTours zt on zt.tourid=t.id inner join ptn_Zones z on z.id=zt.zoneid left join ptn_TourCost tc on tc.tourid=t.id where t.IsActive=1 and ISNULL(tc.startdate,getdate())<=getdate() and ISNULL(tc.enddate,getdate())>=getdate() and zt.Zoneid=" & Request.QueryString("zid") & "  order by t.updatedon desc"
                Fill_dtList(dlTours, strSql)
                'Dim ZoneName As Label = dlTours.Items(0).FindControl("lblZone")
                'ltrTitle.Text = "<h2>Tours in " & ZoneName.Text & " </h2>"
                Dim txt As Array
                txt = RetriveData("select Name from ptn_Zones where Id=" & Request.QueryString("zid"), 0)
                ltrTitle.Text = "<h2>Tours in " & txt(0) & " </h2>"
                If dlTours.Items.Count = 0 Then
                    lblMsg.Text = "No Records"
                End If
            End If
        Catch ex As Exception
            Throw ex
        End Try
    End Sub

    Public Function IsPriceNull(ByVal Value As Integer) As String
        If Value = 0 Then
            Return "<span class=""contact"">Contact for price</span>"
        Else
            Return "<span class=""label"">Starts from</span><span class=""amount"">" & Value & "</span>"
        End If
    End Function

    Protected Function ShowThumbnail(ByVal Image As String)
        Dim strImage As String
        If Image Is Nothing Then
            strImage = "Images/no-image.jpg"
        Else
            strImage = "Images/Img/" & Image
        End If
        Return strImage
    End Function

End Class